package com.example.demo.config;

import com.example.demo.netty.NettyServerManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ApplicationConfiguration implements ApplicationRunner {

    @Autowired
    private NettyServerManager nettyApiServerManager;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        try{
            nettyApiServerManager.startAll();
        }catch (Exception e){
            log.error("start netty api service exception.", e);
        }
    }
}
